<?php
class System_App_Controller_Abstract extends System_App_Noyau{
    public $view;
    private $_renderView = true;
    
    function __construct(){
        $this->view = new System_App_Manager_Vue();
        $this->init();
    }
    
    public function init(){
        
    }
    
    public function doAction( $action ){
        if( method_exists($this, $action ) ){
            return call_user_func( array( $this, $action ) );
        }else{
            System_App_Erreur::page404();
        }
    }
    
    public function desableView(){
        $this->_renderView = false;
    }
    public function enableView(){
        $this->_renderView = true;
    }
    
    public function dispatch(){
        $this->resultAction = $this->doAction( $this->rooter->getConfigAction() );
        
        $this->preDispatch();
        
        if( $this->_renderView ){
            $this->returnDispatch = $this->view->getView();
        }else{
            // TODO formater le retour selon demande : brut, json, xml
            $this->returnDispatch =  $returnAction;
        }
        
        $this->postDispatch();
        
        return $this->returnDispatch;
    }
}

?>